package com.wc.AlgoOJ_train.train3_算法大礼包.c1_广度优先搜索.AG0207_倒水;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

/**
 * @Author congge
 * @Date 2024/1/27 18:21
 * @description 倒水
 * http://43.138.190.70:8888/p/AG0207
 */
public class Main {
    /**
     * 状态表示 1 FILL(1)
     * 状态表示 2 FILL(2)
     * 状态表示 3 DROP(1)
     * 状态表示 4 DROP(2)
     * 状态表示 5 POUR(1,2)
     * 状态表示 6 POUR(2,1)
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int a, b, c;
    // x 表示 1, y 表示 2, 当前的量
    static int x = 0, y = 0;
    static int N = 2010;
    static int pos = 2000;
    // static[i][j] 表示状态转移,转移到 0 0 结束
    static int[][] state = new int[N][N];
    // operator[i][j] 表示到达该状态的操作
    static int[][] operator = new int[N][N];
    static Map<Integer, String> num2Operator = new HashMap<>();

    static void init() {
        num2Operator.put(1, "FILL(1)");
        num2Operator.put(2, "FILL(2)");
        num2Operator.put(3, "DROP(1)");
        num2Operator.put(4, "DROP(2)");
        num2Operator.put(5, "POUR(1,2)");
        num2Operator.put(6, "POUR(2,1)");
        state[0][0] = -1;
    }

    public static void main(String[] args) {
        init();
        a = sc.nextInt();
        b = sc.nextInt();
        c = sc.nextInt();
        int stateEnd = bfs();
        if (stateEnd == -2) {
            out.println("impossible");
        } else {
            StringBuffer ans = new StringBuffer();
            int step = 0;
            while (stateEnd != -1) {
                step++;
                x = stateEnd / pos;
                y = stateEnd % pos;

                ans.insert(0, num2Operator.get(operator[x][y]));
                ans.insert(0, '\n');
                stateEnd = state[x][y];
            }
            ans.insert(0, step);
            out.println(ans);
        }
        out.flush();
    }

    static int bfs() {
        Queue<Integer> q = new LinkedList<>();
        q.add(0);
        q.add(0);
        int nx, ny;
        while (!q.isEmpty()) {
            x = q.poll();
            y = q.poll();
            if (x == c || y == c) {
                return x * pos + y;
            }
            int curState = x * pos + y;

            // 原始状态得特殊判定,不然下面的内容==0，都成了原始态了
            if (curState == 0) curState = -1;
            // 状态1 FILL(1)
            nx = a;
            ny = y;
            if (state[nx][ny] == 0) {
                // 存上一个状态
                state[nx][ny] = curState;
                operator[nx][ny] = 1;
                q.add(nx);
                q.add(ny);
            }
            // 状态2 FILL(2)
            nx = x;
            ny = b;
            if (state[nx][ny] == 0) {
                state[nx][ny] = curState;
                operator[nx][ny] = 2;
                q.add(nx);
                q.add(ny);
            }
            // 状态3 DROP(1)
            nx = 0;
            ny = y;
            if (state[nx][ny] == 0) {
                state[nx][ny] = curState;
                operator[nx][ny] = 3;
                q.add(nx);
                q.add(ny);
            }
            // 状态4 DROP(2)
            nx = x;
            ny = 0;
            if (state[nx][ny] == 0) {
                state[nx][ny] = curState;
                operator[nx][ny] = 4;
                q.add(nx);
                q.add(ny);
            }

            // 状态5 POUR(1,2)
            ny = Math.min(b, y + x);
            nx = x + y - ny;
            if (state[nx][ny] == 0) {
                state[nx][ny] = curState;
                operator[nx][ny] = 5;
                q.add(nx);
                q.add(ny);
            }

            // 状态6 POUR(2,1)
            nx = Math.min(a, x + y);
            ny = x + y - nx;
            if (state[nx][ny] == 0) {
                state[nx][ny] = curState;
                operator[nx][ny] = 6;
                q.add(nx);
                q.add(ny);
            }
        }

        return -2;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
